subroutine initVP(a,i,i_time,i_vertex3D,i_nVer3D,i_points,&
    i_MN,i_alp,i_T0,i_num,i_numbersEl,wk3d_dat,nMN,nPoints,nAreas,&
    i_vertex2D,i_nVer2D ,nodesCount2D,elemsCount2D)
    dimension a(120000000),i(100000000)
    common /commonInfo/ eps2d,eps3d,eps3dNS,radiusRED,maxiter,typeTask,nt,nMaterials,calcWK,calcVP
    common /commonIndex/ indexI,indexA
    common /dim3D/nodesCount3D,elemsCount3D,nodesBoundCount3D,edgesTermCount3D,&
    edgesNotTermCount3D,edgesCount3D,nodesTermCount3D,m3D,mTerm3d,nodesNotTermCount3D
    real*8 a,eps2d,eps3d,eps3dNS,radiusRED
    integer calcWK,calcVP
    integer inftry_dat,tsize3d_dat,xyz_dat,nver_dat,ig3d_dat,&
    jg3d_dat,gg3d_dat,wk3d_dat,points_txt,MN_txt,areaProperties_txt,inf2tr_dat,&
    rz_dat,nvtr_dat,tsize_dat
    integer elemsCount2D,edgesTermCount3D,edgesNotTermCount3D,edgesCount3D,&
    elemsCount3D

    !opening files
    call open_files_VP(inftry_dat,tsize3d_dat,xyz_dat,nver_dat,&
    wk3d_dat,points_txt,MN_txt,areaProperties_txt,inf2tr_dat,&
    rz_dat,nvtr_dat,tsize_dat)

    read(areaProperties_txt,*) nAreas
    read(points_txt,*) nPoints
    read(MN_txt,*) nMN

    !input 3D data
101 format(' ISLAU=',i8,' INDKU1=',i8,' INDFPO=',i8)
102 format('KUZLOV=',i8,'    KPAR=',i8,'    KT1=',i8,'    KT2=',i8,'    KT3=',i8)
105 format(' ISLAU=',i8,' INDKU1=',i8,' INDFPO=',i8)
106 format('KUZLOV=',i8,'    KPAR=',i8,'    KT1=',i8)
    read(inftry_dat,101)k,k,k
    read(inftry_dat,102) nodesCount3D,elemsCount3D,nodesBoundCount3D
    read(tsize3d_dat,*)nodesTermCount3D
    nodesNotTermCount3D = nodesCount3D-nodesTermCount3D        

    i_vertex3D      = indexA
    i_points        = i_vertex3D+3*nodesCount3D
    i_MN            = i_points+3*nPoints
    i_alp           = i_MN+6*nMN
    i_T0            = i_alp+nAreas

    i_nVer3D        = indexI
    i_num           = i_nVer3D+14*elemsCount3D
    i_numbersEl     = i_num*2+nAreas

    call input3D_VP(a(i_vertex3D),i(i_nVer3D),i(i_numbersEl),xyz_dat,nver_dat)
    call readPoints(points_txt,a(i_points),nPoints)
    call readMN(MN_txt,a(i_MN),nMN)
    call readAreaProperties(areaProperties_txt,a(i_alp),a(i_T0),i(i_num),nAreas)
    
    
    read(inf2tr_dat,101)k,k,k
    read(inf2tr_dat,102) nodesCount2D,elemsCount2D,nodesBoundCount2D,k1,k2
    read(tsize_dat,*)nodesTermCount2D
    nodesNotTermCount2D = nodesCount2D-nodesTermCount2D
    
    i_vertex2D      = i_T0+nAreas
    i_nVer2D        = i_numbersEl+8*nodesCount3D
    call input2D_VP(a(i_vertex2D),i(i_nVer2D),rz_dat,nvtr_dat,nodesCount2D,elemsCount2D)

    call close_files_VP(inftry_dat,tsize3d_dat,xyz_dat,nver_dat,&
    points_txt,MN_txt,areaProperties_txt,inf2tr_dat,rz_dat,nvtr_dat,tsize_dat)
end
!*************************************************************************
!opening files
subroutine open_files_VP(inftry_dat,tsize3d_dat,xyz_dat,nver_dat,&
    wk3d_dat,points_txt,MN_txt,areaProperties_txt,inf2tr_dat,rz_dat,&
    nvtr_dat,tsize_dat)
    integer inftry_dat,tsize3d_dat,xyz_dat,nver_dat,wk3d_dat,&
    points_txt,MN_txt,areaProperties_txt,inf2tr_dat,rz_dat,nvtr_dat,tsize_dat

    !mesh3D
    inftry_dat         = 101
    tsize3d_dat        = 102
    xyz_dat            = 103
    nver_dat           = 104
    areaProperties_txt = 105
    open(inftry_dat,file='.\calculations\mesh3d\inftry.dat',mode='read')
    open(tsize3d_dat,file='.\calculations\mesh3d\tsize3d.dat',mode='read')
    open(xyz_dat,file='.\calculations\mesh3d\xyz.dat',access='direct',recl=24,mode='read')
    open(nver_dat,file='.\calculations\mesh3d\nver.dat',access='direct',recl=56,mode='read')
    open(areaProperties_txt,file='.\calculations\vp\areaProperties.txt',mode='read')
    
    !mesh2D 
    inf2tr_dat  = 201
    rz_dat      = 202
    nvtr_dat    = 203
    tsize_dat   = 204
    open(inf2tr_dat,file='.\calculations\mesh2d\inf2tr.dat',mode='read')    
    open(rz_dat,file='.\calculations\mesh2d\rz.dat',access='direct',recl=16,mode='read')
    open(nvtr_dat,file='.\calculations\mesh2d\nvtr.dat',access='direct',recl=24,mode='read')
    open(tsize_dat,file='.\calculations\mesh2d\tsize.dat',mode='read')    

    !solutions
    wk3d_dat           = 301

    !points & MN
    points_txt         = 401
    MN_txt             = 402
    open(points_txt,file='.\calculations\points.txt',mode='read')
    open(MN_txt,file='.\calculations\MN.txt',mode='read')
end
!*************************************************************************
subroutine input3D_VP(vertex,nVer,numbersEl,xyz_dat,nver_dat)
    common /dim3D/nodesCount3D,elemsCount3D,nodesBoundCount3D,edgesTermCount3D,&
    edgesNotTermCount3D,edgesCount3D,nodesTermCount3D,m3D,mTerm3d,nodesNotTermCount3D
    integer xyz_dat,nver_dat
    integer edgesTermCount3D,edgesNotTermCount3D,edgesCount3D,elemsCount3D
    real*8 vertex,ggT3D,minX,maxX,minY,maxY,minZ,maxZ
    dimension vertex(3,nodesCount3D),nVer(14,elemsCount3D),l13d(1),numbersEl(8,nodesCount3D)

    call readMesh3D(xyz_dat,0,nver_dat,0,0,0,vertex,l13d,nVer,l13d,&
    l13d,nodesCount3D,elemsCount3D,0,0,minX,maxX,minY,maxY,minZ,maxZ)
    call getNumbersElementForVertex3D(nVer,numbersEl,elemsCount3D,nodesCount3D)
end
!*************************************************************************
subroutine input2D_VP(vertex,nVer,rz_dat,nvtr_dat,nodesCount2D,elemsCount2D)
    integer rz_dat,nvtr_dat,elemsCount2D    
    real*8 vertex,minR,maxR,minZ,maxZ
    dimension vertex(2,nodesCount2D),nVer(4,elemsCount2D),l1(1)

    call readMesh2D(rz_dat,0,nvtr_dat,0,vertex,l1,nVer,&
    l1,nodesCount2D,elemsCount2D,0,minR,maxR,minZ,maxZ)
end
!*************************************************************************
subroutine close_files_VP(inftry_dat,tsize3d_dat,xyz_dat,nver_dat,&
    points_txt,MN_txt,areaProperties_txt,inf2tr_dat,rz_dat,nvtr_dat,tsize_dat)
    integer inftry_dat,tsize3d_dat,xyz_dat,nver_dat,points_txt,&
    MN_txt,areaProperties_txt,inf2tr_dat,rz_dat,nvtr_dat,tsize_dat

    close(inftry_dat)
    close(tsize3d_dat)
    close(xyz_dat)
    close(nver_dat)
    close(points_txt)
    close(MN_txt)
    close(areaProperties_txt)
    close(inf2tr_dat)
    close(rz_dat)
    close(nvtr_dat)
    close(tsize_dat)
end
!*************************************************************************
!*************************************************************************
!*************************************************************************